package com.dongdong.mapper;

/**
 * @author dongdong 抖音号：W13883155245
 * @version 1.0
 * @date 2025/5/5
 * @description
 */

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dongdong.entity.Filepath;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface FilepathMapper extends BaseMapper<Filepath> {
    @Select("SELECT * FROM filepath WHERE user_id = #{userId}")
    List<Filepath> selectByUserId(Long userId);

    @Select("SELECT * FROM filepath WHERE pile_number = #{pileNumber}")
    List<Filepath> selectByPileNumber(String pileNumber);

    @Select("SELECT * FROM filepath WHERE pile_number = #{pileNumber} AND operation LIKE CONCAT('%', #{operation}, '%')")
    List<Filepath> selectByPileNumberAndOperation( @Param("pileNumber")String pileNumber, @Param("operation") String operation);

    @Insert("INSERT INTO filepath (user_id, file_path, file_name,pile_number,operation,file_type) VALUES (#{userId}, #{filePath}, #{fileName},#{pileNumber},#{operation},#{fileType})")
    int insert(Filepath filepath);

}